import Vue from 'vue'
import Vuex from 'vuex'
import {
  SET_TOKEN,
  GET_TOKEN,
  DEL_TOKEN
} from '@/utils/storage.js'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: GET_TOKEN('SET_TOKEN')
  },
  mutations: {
    SET_TOKEN(state, user) {
      window.localStorage.setItem('SET_TOKEN', JSON.stringify(user))
      state.user = user
    }
  },
  actions: {},
  modules: {}
})
